app.controller("mainCtr", function($scope, $rootScope, $http, $interval) {
	//	主要内容部分
	
	//轮播图部分
	$http({
		method: "GET",
		url: "php/main.php"
	}).then(function(res) {
		$scope.topImgArray = res.data;
		$scope.maxIndex = $scope.topImgArray.length;
	});
	//定时器
	$scope.index = 0;
	$scope.mouseLeave = function() {
			$scope.timer = $interval(function() {
				$scope.index++;
				if($scope.index > $scope.maxIndex - 1) {
					$scope.index = 0;
				}
			}, 2000);
		}
		//鼠标移入事件
	$scope.mouseEnter = function(val) {
		$interval.cancel($scope.timer);
		$scope.index = val - 1;
	}
	$scope.$on('destroy', function() {
			$interval.cancel($scope.timer);
		}) //在控制器里，添加$on函数
//$route.reload();
});